<?php 
class db_item_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
    
    //-------------------------------------------------------------------------
    //---------------------------- FOR ITEM TABLE -----------------------------
    //-------------------------------------------------------------------------
    
    function insert_onduplicate_Item($aParamsi,$aUpdate){
        $this->db->on_duplicate_update(PREFIX.'item', $aUpdate, $aParamsi); 
        //echo $this->db->last_query();exit;
        $count 	= $this->db->affected_rows();		
        if($count>0) return $count;
    }
    function getItem($Params=array()){
         $query = $this->db->select('id,name,type,gid,amount,gid,sid,character_name,username,image,created,confirm_order,trans_order,translog,transID')
                            ->where($Params)
                            ->from(PREFIX."item")
                            ->order_by("created", "desc")
                            ->get();
         return $query->result();
    }
    function getItembySqlStr($str=''){
        if($str!=''){
            $query = $this->db->select('id, name,type,gid,amount,gid,sid,character_name,username,image,created,confirm_order,trans_order,translog,transID')
                                ->where($str)
                                ->from(PREFIX."item")
                                ->order_by("created", "desc")
                                ->get();
            return $query->result();
        }
        return 0;
    }
}
?>
